<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>第一个子元素设置上外边距时，父元素需要设置overflow: hidden;</title>
    <style>
    .box{
        width: 1200px;
        height: 500px;
        margin: 0 auto;
        background: palevioletred;
        overflow: hidden;
    }
    .box1{
        width: 100%;
        height: 200px;
        background: purple;
        margin-top: 50px;
    }
    </style>
</head>
<body>
    <div class="box">
        <div class="box1"></div>
    </div>
</body>
</html>